package com.minimalist.common.entity.lindi.vo.purchaseapplication;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.minimalist.common.entity.lindi.vo.purchaseapplicationtownitem.LindiPurchaseApplicationTownItemVO;
import com.minimalist.common.utils.Add;
import com.minimalist.common.utils.Update;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;

/**
 * 林地指标交易平台_指标购买申请审批VO类。
 *
 * @author 11987
 * @since 2025-07-01
 */
@Schema(description = "林地指标交易平台_指标购买申请审批实体")
public class LindiPurchaseApplicationApprovalVO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "购买申请ID不能为空", groups = {Add.class, Update.class})
    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "购买申请ID")
    private Long purchaseApplicationId;

    @NotNull(message = "审批结果不能为空", groups = {Add.class, Update.class})
    @Schema(description = "审批结果：1-通过，2-驳回")
    private Integer approvalResult;

    @NotBlank(message = "审批意见不能为空", groups = {Add.class, Update.class})
    @Schema(description = "审批意见")
    private String approvalComment;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "审批人ID")
    private Long approverId;

    @Schema(description = "审批人姓名")
    private String approverName;

    @Schema(description = "审批时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime approvalTime;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "更新人ID")
    private Long updateId;

    @Schema(description = "更新时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private LocalDateTime updateTime;

    @Schema(description = "镇街购买指标列表")
    private List<LindiPurchaseApplicationTownItemVO> townItemList;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "确认函文件ID")
    private Long confirmationFileId;

    @JsonSerialize(using = ToStringSerializer.class)
    @Schema(description = "租户ID")
    private Long tenantId;

    // Getter和Setter方法
    public Long getPurchaseApplicationId() {
        return purchaseApplicationId;
    }

    public void setPurchaseApplicationId(Long purchaseApplicationId) {
        this.purchaseApplicationId = purchaseApplicationId;
    }

    public Integer getApprovalResult() {
        return approvalResult;
    }

    public void setApprovalResult(Integer approvalResult) {
        this.approvalResult = approvalResult;
    }

    public String getApprovalComment() {
        return approvalComment;
    }

    public void setApprovalComment(String approvalComment) {
        this.approvalComment = approvalComment;
    }

    public Long getApproverId() {
        return approverId;
    }

    public void setApproverId(Long approverId) {
        this.approverId = approverId;
    }

    public String getApproverName() {
        return approverName;
    }

    public void setApproverName(String approverName) {
        this.approverName = approverName;
    }

    public LocalDateTime getApprovalTime() {
        return approvalTime;
    }

    public void setApprovalTime(LocalDateTime approvalTime) {
        this.approvalTime = approvalTime;
    }

    public Long getUpdateId() {
        return updateId;
    }

    public void setUpdateId(Long updateId) {
        this.updateId = updateId;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public List<LindiPurchaseApplicationTownItemVO> getTownItemList() {
        return townItemList;
    }

    public void setTownItemList(List<LindiPurchaseApplicationTownItemVO> townItemList) {
        this.townItemList = townItemList;
    }

    public Long getConfirmationFileId() {
        return confirmationFileId;
    }

    public void setConfirmationFileId(Long confirmationFileId) {
        this.confirmationFileId = confirmationFileId;
    }

    public Long getTenantId() {
        return tenantId;
    }

    public void setTenantId(Long tenantId) {
        this.tenantId = tenantId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        LindiPurchaseApplicationApprovalVO that = (LindiPurchaseApplicationApprovalVO) o;
        return Objects.equals(purchaseApplicationId, that.purchaseApplicationId) &&
                Objects.equals(approvalResult, that.approvalResult) &&
                Objects.equals(approvalComment, that.approvalComment) &&
                Objects.equals(approverId, that.approverId) &&
                Objects.equals(approverName, that.approverName) &&
                Objects.equals(approvalTime, that.approvalTime) &&
                Objects.equals(updateId, that.updateId) &&
                Objects.equals(updateTime, that.updateTime) &&
                Objects.equals(townItemList, that.townItemList) &&
                Objects.equals(confirmationFileId, that.confirmationFileId) &&
                Objects.equals(tenantId, that.tenantId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(purchaseApplicationId, approvalResult, approvalComment, approverId, approverName, approvalTime, updateId, updateTime, townItemList, confirmationFileId, tenantId);
    }

    @Override
    public String toString() {
        return "LindiPurchaseApplicationApprovalVO{" +
                "purchaseApplicationId=" + purchaseApplicationId +
                ", approvalResult='" + approvalResult + '\'' +
                ", approvalComment='" + approvalComment + '\'' +
                ", approverId=" + approverId +
                ", approverName='" + approverName + '\'' +
                ", approvalTime=" + approvalTime +
                ", updateId=" + updateId +
                ", updateTime=" + updateTime +
                ", townItemList=" + townItemList +
                ", confirmationFileId=" + confirmationFileId +
                ", tenantId=" + tenantId +
                '}';
    }
}